<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>用户注册</title>
	<script type="text/javascript" src="/static/home/js/jquery-3.2.1.min.js"></script>
</head>
<body>
<center>
    <form action="{:url('User/regist')}" method="post">
        <table>
            <tr>
                <td>手机号</td>
                <td><input type="text" name="username" id="tel"/></td>
            </tr>
            <tr>
                <td>验证码</td>
                <td><input type="text" name="yanzhengma" id=""><span><button id="btn" type="button" onclick="sendsmss()" >免费发送验证码</button></span></td>
            </tr>
            <tr>
                <td>密码</td>
                <td><input type="password" name="password" /></td>
            </tr>
            <tr>
                <td>确认密码</td>
                <td><input type="password" name="password1" /></td>
            </tr>
            <tr>
                <td><input type="submit" value="注册" /></td>
                <td></td>
            </tr>

        </table>
    </form>
</center>
<script type="text/javascript">
    function sendsmss() {
	//alert("www");
    var mobile = $("#tel").val();
	alert(mobile.length);
    if (mobile == "") {
        
        alert("请输入手机号码");
        return;
    }
    $.ajax({
				type: "POST",
				dataType: "json",
				url: "{:url('User/Verification')}",
				data:{mobile:mobile}, 
				success: function(msg){
				//alert (msg);
				
					if(msg=="1"){
					
					var i=60;
					var x=setInterval(function(){
						$('#sendCodes').val('请等待（'+i+'）');
						i--;
						if(i<=1)
						{
							clearInterval(x)
							$('#sendCode').text('重新发送');
							$('#sendCode').removeAttr('readonly')
						}						
					},1000);
					
					alert("发送成功");
						//$("#errro_brand").html("请检查当前登陆城市或宽带账号是否正确！");
						//return false;
					}else if(msg=="2"){
					alert("发送失败");
						 //$("#errro_pop_tel").html("请输入正确的手机号！");
						 //return false;
					}
					else if(msg=="3"){
					alert("手机号不能为空");
						 //$("#errro_pop_tel").html("请输入正确的手机号！");
						 //return false;
					}
					else if(msg=="4"){
					alert("手机号码格式不正确");
						 //$("#errro_pop_tel").html("请输入正确的手机号！");
						 //return false;
					}
					else if(msg=="5"){
					alert("该手机号已经被人注册过");
						 //$("#errro_pop_tel").html("请输入正确的手机号！");
						 //return false;
					}
					
					
				}
					
			   });
}
</script>
</body>

</html>
